home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_gen_noreachnolinetalk.cog < prev    next >
Text File  |  1999-11-15  |  6KB  |  201 lines

  1. # Jones 3D Cog Script
  2. #
  3. # gen_NoReachNoLineTalk.cog
  4. #
  5. # Indy comments upon his poor position in life
  6. #
  7. # [HB]
  8. #
  9. # (C) 1999 LucasArts Entertainment Co. All Rights Reserved
  10. # ==============================================================================
  11.  
  12. # NOTE: This is a random verbal reaction to being in the wrong place...
  13. # Glue it into your level and reach it from a calling cog like this:
  14. #
  15. # 1. Create a valid reference to this cog in your calling cog;
  16. #
  17. # 2. Use the following verb:
  18. #    SendMessageEx(thiscogREF, i_userMessage, f_parm0, f_parm1, f_parm2, f_parm3);
  19. #    (see each section below for details...)
  20. #
  21. # 3. Use global15 as a semaphore and return value where neeeded;
  22. #
  23. # The resulting chatter is pre-approved by HB...
  24. #
  25. # PRODUCT SUPPORT:  cogsrus x8371
  26.  
  27. # ==============================================================================
  28.  
  29. symbols
  30.  
  31. # ................................. MESSAGES ...................................
  32.  
  33.     message user0    # can't reach lines
  34.     message user1    # must line up lines
  35.  
  36. # ................................. SAY LINES ..................................
  37.  
  38.     # can't reach lines...
  39.     sound    in_sayline=Inxj215.wav                local # Can't reach-->in_sayline[0]
  40.     sound    in_noquitereach=Inxj216.wav            local # Can't quite reach.
  41.     sound    in_noreachthat=Inxj217.wav            local # Can't reach that.
  42.     sound    in_noreachhere=Inxj218.wav            local # Nothing I can reach here.
  43.     
  44.     # not lined up lines...
  45.     sound    in_notlined=Inxj219.wav                local # Not lined up right-->in_sayline[4]
  46.     sound    in_needline=Inxj220.wav                local # Need to line up
  47.     sound    in_moveover=Inxj221.wav                local # Need to move over.
  48.     sound    in_notinpos=Inxj222.wav                local # Not quite in position.
  49.     sound    in_needpos=Inxj223.wav                local # Need to get in position.
  50.     sound    in_betterspot=Inxj224.wav            local # Need to find better spot.
  51.  
  52. # ............................... VARIABLES ....................................
  53.  
  54.     flex    talkerREF                            local
  55.     flex    forceTalk                            local
  56.     flex    forceLine                            local
  57.     
  58.     int        lineindex                            local # indexes sound array
  59.     int        reachoffset=0                        local # define
  60.     int        lineupoffset=4                        local # define
  61.  
  62.     int        alreadyworking=0                    local
  63.  
  64.     int        r_newline=50                        local # init outside actual range
  65.     int        r_oldline=50                        local
  66.     int        l_newline=50                        local
  67.     int        l_oldline=50                        local
  68.  
  69.     int        dummy
  70.  
  71. # subroutines
  72.     flex    randreachlines=0.0                    local
  73.     flex    randlineuplines=0.0                    local
  74. end
  75.  
  76. # ==============================================================================
  77.  
  78. code
  79.  
  80. # ..............................................................................
  81.  
  82. user0:
  83.  
  84.     # NOTE: Indy comments on something being OUT OF REACH...
  85.     #
  86.     # Proper command to reach this response section from the calling cog is:
  87.     #
  88.     # SendMessageEx(negtalkcogREF, user0, f_talkerREF, f_forceTalk, f_forceLine, 0);
  89.     #
  90.     # global15 is used here like so:
  91.     #
  92.     # global15 == 0 while this cog is at work (waiting for line to finish)
  93.     # global15 == 1 upon return
  94.     #
  95.     # As discussed in user0 section, the calling cog can use global15 as a semaphore
  96.     #
  97.     # Hey!  You can also force a line choice.  Here's how:
  98.     # 1. Note your intention by setting f_forceTalk parm to some non-zero value
  99.     # 2. Examine the available lines to find the one you want (counting from 0)
  100.     # 3. Pass that number in the forceLine parameter (parm2)
  101.  
  102.     if (alreadyworking > 0)
  103.     {
  104.         return;
  105.     }
  106.  
  107.     alreadyworking = 1; # stall multiple calls
  108.  
  109.     global15 = 0; # init each call
  110.  
  111.     talkerREF = GetParam(0); # is player or an actor talking? (a cast)
  112.     forceTalk = GetParam(1); # force a choice
  113.     forceLine = GetParam(2); # actual line choice
  114.     
  115.     if (forceTalk > 0)
  116.     {
  117.         r_newline = forceLine; # choose this line
  118.         r_oldline = 0;
  119.     }
  120.  
  121.     call randreachlines;
  122.     global15 = 1;
  123.     alreadyworking = 0;
  124.  
  125.     return;
  126.  
  127. # ........................................................................................
  128.  
  129. user1:
  130.  
  131.     # NOTE: Indy laments that something DIDN'T WORK as hoped...
  132.     #
  133.     # Proper command to reach this response section from the calling cog is:
  134.     #
  135.     # SendMessageEx(negtalkcogREF, user1, f_talkerREF, f_forceTalk, f_forceLine, 0);
  136.     #
  137.     # global15 is used here like so:
  138.     #
  139.     # global15 == 0 while this cog is at work (waiting for line to finish)
  140.     # global15 == 1 upon return
  141.     #
  142.     # As discussed in user0 section, you can force a line choice.
  143.  
  144.     if (alreadyworking > 0)
  145.     {
  146.         return;
  147.     }
  148.  
  149.     alreadyworking = 1; # stall multiple calls
  150.  
  151.     global15 = 0; # init each call
  152.  
  153.     talkerREF = GetParam(0); # is player or an actor talking? (a cast)
  154.     forceTalk = GetParam(1); # force a choice
  155.     forceLine = GetParam(2); # actual line choice
  156.     
  157.     if (forceTalk > 0)
  158.     {
  159.         l_newline = forceLine; # choose this line
  160.         l_oldline = 0;
  161.     }
  162.  
  163.     call randlineuplines;
  164.     global15 = 1;
  165.     alreadyworking = 0;
  166.  
  167.     return;
  168.  
  169. # ..............................................................................
  170.  
  171. randreachlines:
  172.  
  173.     while (r_newline == r_oldline)
  174.     {        
  175.         r_newline = RandBetween(0, 3);
  176.     }
  177.     r_oldline = r_newline;
  178.     lineindex = reachoffset + r_newline; # 1/4 chance
  179.  
  180.     PlayVoice(talkerREF, in_sayline[lineindex], 1, 1);
  181.  
  182.     return;
  183.  
  184. # ..............................................................................
  185.  
  186. randlineuplines:
  187.  
  188.     while (l_newline == l_oldline)
  189.     {        
  190.         l_newline = RandBetween(0, 5);
  191.     }
  192.     l_oldline = l_newline;
  193.     lineindex = lineupoffset + l_newline; # 1/6 chance
  194.  
  195.     PlayVoice(talkerREF, in_sayline[lineindex], 1, 1);
  196.  
  197.     return;
  198.  
  199. end
  200.  
  201.